package com.wangyadong.hobby.schedule.jobtask.dsa.recursive;

import java.io.File;

public class FileSystemRecursive {

    public static final String PATH = "C:\\java\\java\\";

    public static long diskUsagePath(File file) {
        long usage = file.length();
        File[] files = file.listFiles();
        if (file.isDirectory()) {
            for (File file1 : files) {
                System.out.println(file1.length() + "  bytes  path is  " + file1.getAbsolutePath());
                usage += diskUsagePath(file1);

            }
        }

        return usage;
    }

    public static long diskUsage(File file) {
        long usage = file.length();
        File[] files = file.listFiles();
        if (files != null && files.length > 0) {
            for (File file1 : files) {
                usage += diskUsage(file1);

            }
        }

        return usage;
    }

    public static void main(String[] args) {

        System.out.println(5 / 3);
//        System.out.println(diskUsagePath(new File(PATH)) / 1024 / 1024 / 1024);
    }
}
